<?php session_start(); ?>
<?php include "libfunc.php";?>
<?php if (!empty($_SESSION['admUser']) && !empty($_SESSION['admPass'])) { ?>
<html>
 <head>
  <title>.: Admin Room Toko Buku Bekas :.</title>
  <link href="admInc/cssMainStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssAdditionStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableNavigation.css" type="text/css" rel="stylesheet">
 </head>
 <body class="fix">
  <div id="wrapper">
   <div id="header">
    <div class="titleHeader"><center>
     <img src="image/logo2.png" border="0">
	</div><!-- titleHeader //-->
	<div class="subTitleHeader"><center>
	 - Website Administrator Control Panel -
	</div><!-- subTitleHeader //-->
   </div><!-- header //--></center>
   <div id="mainContent">
    <div id="leftColumn">
	 <div class="navigation">
	  <table border="0" width="100%" bgcolor="white">
	  <tr>
	    <td class="headerTable" align="center"><b>Admin Page</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="adminLayout.php"> Halaman Utama</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="newInformation.php"> Informasi Terkini</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="LogOut.php" onClick="return confirm('Apakah Anda benar-benar akan keluar dari halaman Admin ?')"> Keluar</a></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Kategori</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_kategori.php"> Tambah Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_kategori.php"> View Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_kategori.php"> Pencarian Kategori</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Member</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_member.php"> Tambah Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_member.php"> View Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_member.php"> Pencarian Member</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_produk.php"> Tambah Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_produk.php"> View Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_produk.php"> Pencarian Produk</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Request Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_request.php"> View Request</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_request.php"> Pencarian Request</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Pesanan</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_pesanan.php"> View Pesanan</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_pesanan.php"> Pencarian Pesanan</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	</table>
	 </div><!-- navigation //-->
	</div><!-- leftColumn //-->
	<div id="rightColumn">
	 <div class="content">
	  <?php 
		  $file  = "view_kategori.php";
		  include "class_paging.php";
		  $p     = new Paging;
		  $batas = 5;
		  $posisi = $p->cariPosisi($batas);
		  
		  
		  $link = koneksi_db();
		  $sql  = "select * from dtkategori limit $posisi,$batas";
		  $res  = mysql_query($sql,$link);
		  $sql2 = "select * from dtkategori";
		  $res2 =  mysql_query($sql2);
		  $jmlrecord = mysql_num_rows($res2);
		  $jmlhalaman = $p->jumlahHalaman($jmlrecord,$batas);
				
		if( $jmlrecord > 0 ){
		?>
	   <fieldset>
        <legend>View Data Kategori</legend>
         <table border='0' align='center' class="tableView">
		  <tr class="trTable">
		    <td>NO</td>
		    <td>ID</td>
			<td>Nama</td>
			<td>Deskripsi</td>
            <td>Dihapus</td>
            <td colspan="2">Aksi</td>
		  </tr>
	  <?php
	     $no = $posisi+1;
		 while( $data = mysql_fetch_array($res) ){
		   ?>
		   <tr>
		     <td><?php echo $no; ?></td>
			 <td><?php echo $data['id_kategori']; ?></td>
			 <td><?php echo $data['nama']; ?></td>
			 <td align="center"><?php echo $data['deskripsi']; ?></td>
             <td>
		      <?php 
			    if ($data['dihapus']=="Y") {
				  echo "Ya";  
			    } else {
				  echo "Tidak";  
			    }
			  ?>
          	 </td>
             <td>
         
				<?php 
                    if($data['dihapus']==T){
                ?>
                    <a href="proses_delete_kategori.php?id=<?php echo $data['id_kategori']; ?>" onClick = "return confirm('Apakah Anda benar-benar akan menghapus Kategori <?php echo $data['nama']; ?>?')"><img src="image/delete.png" title="Delete" border="0"></a>
                <?php 
                    }else{ 
                ?>
                    <a href="#" onClick = "return alert('Status Kategori <?php echo $data['nama']; ?> telah terhapus!')"><img src="image/delete.png" title="Delete" border="0"></a>
                <?php
                    }
                ?>
		  	 </td>
             <td align="center">
		   		<a href="form_edit_kategori.php?id=<?php echo $data[id_kategori]; ?>"><img src="image/page_edit.png" title="Edit" border="0"></a>
		  	 </td>
           </tr>
         
      <?php
	         $no++;
		 } //------------------------------end of while-----------
	  ?>
	  	</table><br><br>
        <span class="paging">
      <?php
	    $linkHalaman = $p->navHalaman($_GET[halaman],$jmlhalaman);
		echo $linkHalaman;
	  ?>
      	</span>
        </fieldset>
        
        <div id="keterangan">
      	 <fieldset>
          <legend>Keterangan</legend>
     		Menu View Data Kategori. Silakan Dilihat !!!
       	 </fieldset>
     	</div>
	<?php
	  }else{ //----------- else of if
    ?>
	    <div id='keterangan'>
         <fieldset>
          <legend>Keterangan</legend>
          Data Kategori Kosong,,Silakan Isi Data Kategori !!!
         </fieldset>
        </div>
	<?php
	  }
	?>
     
     </div><!-- content //-->
	</div><!-- rightColumn //-->
   </div><!-- mainContent //-->
  </div><!-- wrapper //-->
 </body>
</html>
<?php
}else{
  echo "<script language='javascript'>alert('Silakan Sign In Terlebih Dahulu')</script>";
  echo "<script language='javascript'>window.location = '../admin/'</script>";
}